package org.yh.moodpraise.rabbitmq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: yh
 * @Date: 2020/6/22
 * @Description:
 */

@Component
public class MQSender {
    @Autowired
    AmqpTemplate amqpTemplate;

    public String sendMessage(Object msg){
        //object -> string  省略msg类型转换
        amqpTemplate.convertAndSend(MQConfiguration.QUEUENAME,msg);
        return (String) msg;
    }
}
